home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / SOM / OpenDoc and SOM / CPlusPlus / Extensn.xh < prev    next >
Encoding:
Text File  |  1994-04-19  |  3.4 KB  |  161 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: Locrian:WWDCSun:CPlusPlus:Extensn.xh.
  5.  * Generated using:
  6.  *     SOM Precompiler somipc: somc/smemit.c
  7.  *     SOM Emitter emitxh.dll: somc/smmain.c
  8.  */
  9.  
  10. /*
  11.  * 
  12.  *  Theory of Operation
  13.  * 
  14.  * 
  15.  *  Classes defined in this interface
  16.  * 
  17.  */
  18.  
  19.  
  20. #ifndef SOM_ODExtension_xh
  21. #define SOM_ODExtension_xh
  22.  
  23. class ODExtension;
  24.  
  25. #define ODExtension_MajorVersion 0
  26. #define ODExtension_MinorVersion 0
  27.  
  28. /* C++ som defs */
  29. #include <somcls.xh>
  30.  
  31. /* Include C++ parent defs */
  32. #ifndef SOM_ODObject_xh
  33. #include <ODObject.xh>
  34. #endif
  35.  
  36. #ifndef ODExtension_API
  37. #define ODExtension_API
  38. /*
  39.  * -- The Class API
  40.  */
  41.  
  42. /*
  43.  * Start of user-defined types:
  44.  */
  45.  
  46. /*
  47.  * End of user-defined types.
  48.  */
  49.  
  50. #if applec ^ PRAGMA_LIB_EXPORT
  51. #pragma lib_export on
  52. #endif
  53.  
  54.  
  55. /* A procedure to create the ODExtension Class */
  56. SOMEXTERN SOMClass * SOMLINK ODExtensionNewClass(
  57.         integer4 majorVersion,
  58.         integer4 minorVersion);
  59.  
  60. /* The API to the ODExtension class object, and the methods it introduces. */
  61. typedef struct ODExtensionClassDataStructure {
  62.     SOMClass *classObject;
  63.     somMToken InitExtension;
  64.     somMToken GetBase;
  65.     somMToken Release;
  66. } ODExtensionClassDataStructure;
  67. #ifdef SOM_NO_DATA_EXPORTS
  68.    SOMEXTERN ODExtensionClassDataStructure * ODExtensionGetClassData ( void );
  69. #   undef ODExtensionClassData
  70. #   define ODExtensionClassData (*ODExtensionGetClassData())
  71. #else
  72.    SOMEXTERN ODExtensionClassDataStructure ODExtensionClassData;
  73. #endif /* SOM_NO_DATA_EXPORTS */
  74.  
  75. #if applec ^ PRAGMA_LIB_EXPORT
  76. #pragma lib_export off
  77. #endif
  78.  
  79. #define _ODExtension ODExtensionClassData.classObject
  80.  
  81. /* The API to parentMtabs for ODExtension, and the instance data it introduces. */
  82. SOMEXTERN struct ODExtensionCClassDataStructure {
  83.     somMethodTabs parentMtab;
  84.     somDToken instanceDataToken;
  85. } ODExtensionCClassData;
  86.  
  87. /*
  88.  * -- Typedefs for Procedures that support Methods introduced by ODExtension
  89.  */
  90. SOMEXTERN {
  91. typedef void   (* SOMLINK somTD_ODExtension_InitExtension)(ODExtension *somSelf, Environment *ev,
  92.         ODObject** base);
  93. typedef ODObject*   (* SOMLINK somTD_ODExtension_GetBase)(ODExtension *somSelf, Environment *ev);
  94. typedef void   (* SOMLINK somTD_ODExtension_Release)(ODExtension *somSelf, Environment *ev);
  95. }
  96.  
  97. #endif /* ODExtension_API */
  98.  
  99.  
  100. /*
  101.  * -- Method Tokens are Thunks
  102.  */
  103. #undef somresolve_
  104. #define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))
  105.  
  106. /*
  107.  * -- The C++ Wrapper Class for ODExtension
  108.  */
  109. class ODExtension : public ODObject
  110. {
  111. public:
  112.  
  113. void *operator new(size_t size)
  114. {
  115.    SOM_IgnoreWarning(size);
  116.    if (!ODExtensionClassData.classObject) 
  117.       ODExtensionNewClass(ODExtension_MajorVersion,ODExtension_MinorVersion);
  118.    return (void *)
  119.       ((somTD_SOMClass_somNew)
  120.       somresolve_((SOMObject *)((void*)(ODExtensionClassData.classObject)),
  121.                  SOMClassClassData.somNew))
  122.          ((SOMClass *)((void*)(ODExtensionClassData.classObject)));
  123. }
  124.  
  125. void operator delete(void * obj)
  126. {
  127.    ((SOMObject *)obj)->somFree();
  128. }
  129.  
  130. /* public method: InitExtension */
  131. void   InitExtension(Environment *ev,
  132.         ODObject** base)
  133. {
  134.    SOM_Resolve(this,ODExtension,InitExtension)
  135.     (this,ev,base);
  136. }
  137.  
  138.  
  139. /* public method: GetBase */
  140. ODObject*   GetBase(Environment *ev)
  141. {
  142.    return SOM_Resolve(this,ODExtension,GetBase)
  143.     (this,ev);
  144. }
  145.  
  146.  
  147. /* public method: Release */
  148. void   Release(Environment *ev)
  149. {
  150.    SOM_Resolve(this,ODExtension,Release)
  151.     (this,ev);
  152. }
  153.  
  154.  
  155.  
  156. };   /* ODExtension */
  157.  
  158.  
  159.  
  160. #endif       /* SOM_ODExtension_xh */
  161.